package com.atguigu.gmall.list.client;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.list.client.impl.ListDegradeFeignClient;
import com.atguigu.gmall.list.model.SearchParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.Map;


/**
 * @author: atguigu
 * @create: 2023-09-02 16:30
 */
@FeignClient(value = "service-list", path = "/api/list", fallback = ListDegradeFeignClient.class)
public interface ListFeignClient {

    /**
     * 对指定商品热门分值进行增加/减少
     *
     * @param skuId
     * @param incrscore
     */
    @ApiOperation("对指定商品热门分值进行增加/减少")
    @GetMapping("/inner/incrHotScore/{skuId}/{incrscore}")
    public void incrHotScore(@PathVariable("skuId") String skuId, @PathVariable("incrscore") int incrscore);


    /**
     * 站内商品检索接口
     *
     * @param searchParam
     * @return
     */
    @ApiOperation("站内商品检索接口")
    @PostMapping({"/"}) //TODO feign接口不知道该调用目标服务哪个接口，调用就会报错
    public Result<Map> search(@RequestBody SearchParam searchParam);
}
